import * as types from "../types/pickerAreaTypes";

const initialState = {
  loading: false,
  error: undefined,
  areaInfo: undefined,
};

export default function helpCenterReducerhomeReducer(state = initialState, action) {
  switch (action.type) {
    case types.PICKER_ALL_LOADING:
      return {
        ...state,
        loading: true,
      };
    case types.PICKER_ALL_DONE:
      return {
        ...state,
        areaInfo: action.areaInfo,
        loading: false,
      };
    case types.PICKER_PROVINCE_ERROR:
      return {
        ...state,
        error: action.error,
        loading: false,
      };
    case types.PICKER_CITY_ERROR:
      return {
        ...state,
        error: action.error,
        loading: false,
      };
    case types.PICKER_COUNTRY_ERROR:
      return {
        ...state,
        error: action.error,
        loading: false,
      };
    default:
      return state;
  }
}
